package com.jushu.storbox.view.dialog;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager.LayoutParams;
import android.widget.PopupWindow;

public class CloudPW {
	private Context context;
	private PopupWindow pw;
	public CloudPW(Context context) {
		this.context = context;
	}

	/***
	 * Init PW
	 * 
	 * @param mPopupWindow
	 * @param resourceId
	 * @return
	 */
	public View initCloudPW(int resourceId) {
		LayoutInflater mInflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View conventView = mInflater.inflate(resourceId, null);
		PopupWindow mPopupWindow = new PopupWindow(conventView, LayoutParams.MATCH_PARENT,
				LayoutParams.WRAP_CONTENT, true);
		mPopupWindow.setTouchable(true);
		mPopupWindow.setOutsideTouchable(true);
		mPopupWindow.setBackgroundDrawable(new BitmapDrawable(context
				.getResources(), (Bitmap) null));
		setPw(mPopupWindow);
		return conventView;
	}
	private void setPw(PopupWindow mPopupWindow){
		this.pw = mPopupWindow;
	}
	public PopupWindow getPw(){
		return this.pw;
	}
}
